<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:widget="http://www.netvibes.com/ns/">
   <head>
  
      <title>Gooogle Calendar</title>
      <link rel="icon" href="http://www.google.com/calendar/images/favicon.ico" type="image/x-icon" />

      <meta name="author" content="Matt Johnson" />
      <meta name="description" content="A Google Calendar widget for Netvibes" />
      <meta name="apiVersion" content="1.0" />
      <meta name="autoRefresh" content="20" />
      <meta name="debugMode" content="true" />
 
      <link rel="stylesheet" type="text/css" href="http://www.netvibes.com/themes/uwa/style.css" />
      <script type="text/javascript" src="http://www.netvibes.com/js/UWA/load.js.php?env=Standalone"></script>
 
      <widget:preferences>
         <preference name="nav" label="Navigation Buttons" type="boolean" defaultValue="true" />
         <preference name="dates" label="Date Button" type="boolean" defaultValue="true" />
         <preference name="tabs" label="Tabs Buttons" type="boolean" defaultValue="true" />
	 <preference name="cals" label="Calendar Buttons" type="boolean" defaultValue="true" />
         <preference name="print" label="Print Button" type="boolean" defaultValue="true" />
         <preference name="timezone" label="Timezone" type="list" defaultValue="America/Chicago">
            <option value="Africa/Accra" label="Africa/Accra" />
            <option value="Africa/Cairo" label="Africa/Cairo" />
            <option value="Africa/Ceuta" label="Africa/Ceuta" />
            <option value="Africa/Johannesburg" label="Africa/Johannesburg" />
            <option value="Africa/Kampala" label="Africa/Kampala" />
            <option value="Africa/Khartoum" label="Africa/Khartoum" />
            <option value="Africa/Nairobi" label="Africa/Nairobi" />
            <option value="Africa/Ouagadougou" label="Africa/Ouagadougou" />
            <option value="Africa/Tunis" label="Africa/Tunis" />
            <option value="Africa/Windhoek" label="Africa/Windhoek" />
            <option value="America/Anchorage" label="America/Anchorage" />
            <option value="America/Araguaina" label="America/Araguaina" />
            <option value="America/Argentina/Buenos_Aires" label="America/Argentina/Buenos_Aires" />
            <option value="America/Bahia" label="America/Bahia" />
            <option value="America/Belem" label="America/Belem" />
            <option value="America/Boa_Vista" label="America/Boa_Vista" />
            <option value="America/Campo_Grande" label="America/Campo_Grande" />
            <option value="America/Chicago" label="America/Chicago" />
            <option value="America/Cuiaba" label="America/Cuiaba" />
            <option value="America/Dawson_Creek" label="America/Dawson_Creek" />
            <option value="America/Denver" label="America/Denver" />
            <option value="America/Edmonton" label="America/Edmonton" />
            <option value="America/Fortaleza" label="America/Fortaleza" />
            <option value="America/Halifax" label="America/Halifax" />
            <option value="America/Havana" label="America/Havana" />
            <option value="America/Iqaluit" label="America/Iqaluit" />
            <option value="America/Lima" label="America/Lima" />
            <option value="America/Los_Angeles" label="America/Los_Angeles" />
            <option value="America/Maceio" label="America/Maceio" />
            <option value="America/Manaus" label="America/Manaus" />
            <option value="America/Montreal" label="America/Montreal" />
            <option value="America/New_York" label="America/New_York" />
            <option value="America/Noronha" label="America/Noronha" />
            <option value="America/Phoenix" label="America/Phoenix" />
            <option value="America/Porto_Velho" label="America/Porto_Velho" />
            <option value="America/Recife" label="America/Recife" />
            <option value="America/Regina" label="America/Regina" />
            <option value="America/Rio_Branco" label="America/Rio_Branco" />
            <option value="America/Sao_Paulo" label="America/Sao_Paulo" />
            <option value="America/St_Johns" label="America/St_Johns" />
            <option value="America/Toronto" label="America/Toronto" />
            <option value="America/Vancouver" label="America/Vancouver" />
            <option value="America/Whitehorse" label="America/Whitehorse" />
            <option value="America/Winnipeg" label="America/Winnipeg" />
            <option value="America/Yellowknife" label="America/Yellowknife" />
            <option value="Asia/Amman" label="Asia/Amman" />
            <option value="Asia/Baghdad" label="Asia/Baghdad" />
            <option value="Asia/Beirut" label="Asia/Beirut" />
            <option value="Asia/Calcutta" label="Asia/Calcutta" />
            <option value="Asia/Damascus" label="Asia/Damascus" />
            <option value="Asia/Dili" label="Asia/Dili" />
            <option value="Asia/Dubai" label="Asia/Dubai" />
            <option value="Asia/Hong_Kong" label="Asia/Hong_Kong" />
            <option value="Asia/Irkutsk" label="Asia/Irkutsk" />
            <option value="Asia/Jerusalem" label="Asia/Jerusalem" />
            <option value="Asia/Kamchatka" label="Asia/Kamchatka" />
            <option value="Asia/Krasnoyarsk" label="Asia/Krasnoyarsk" />
            <option value="Asia/Kuwait" label="Asia/Kuwait" />
            <option value="Asia/Magadan" label="Asia/Magadan" />
            <option value="Asia/Muscat" label="Asia/Muscat" />
            <option value="Asia/Nicosia" label="Asia/Nicosia" />
            <option value="Asia/Omsk" label="Asia/Omsk" />
            <option value="Asia/Pyongyang" label="Asia/Pyongyang" />
            <option value="Asia/Qatar" label="Asia/Qatar" />
            <option value="Asia/Rangoon" label="Asia/Rangoon" />
            <option value="Asia/Riyadh" label="Asia/Riyadh" />
            <option value="Asia/Seoul" label="Asia/Seoul" />
            <option value="Asia/Shanghai" label="Asia/Shanghai" />
            <option value="Asia/Singapore" label="Asia/Singapore" />
            <option value="Asia/Taipei" label="Asia/Taipei" />
            <option value="Asia/Tehran" label="Asia/Tehran" />
            <option value="Asia/Tokyo" label="Asia/Tokyo" />
            <option value="Asia/Vladivostok" label="Asia/Vladivostok" />
            <option value="Asia/Yakutsk" label="Asia/Yakutsk" />
            <option value="Asia/Yekaterinburg" label="Asia/Yekaterinburg" />
            <option value="Asia/Yerevan" label="Asia/Yerevan" />
            <option value="Atlantic/Azores" label="Atlantic/Azores" />
            <option value="Atlantic/Canary" label="Atlantic/Canary" />
            <option value="Atlantic/Reykjavik" label="Atlantic/Reykjavik" />
            <option value="Australia/Adelaide" label="Australia/Adelaide" />
            <option value="Australia/Brisbane" label="Australia/Brisbane" />
            <option value="Australia/Darwin" label="Australia/Darwin" />
            <option value="Australia/Hobart" label="Australia/Hobart" />
            <option value="Australia/Perth" label="Australia/Perth" />
            <option value="Australia/Sydney" label="Australia/Sydney" />
            <option value="Europe/Amsterdam" label="Europe/Amsterdam" />
            <option value="Europe/Andorra" label="Europe/Andorra" />
            <option value="Europe/Athens" label="Europe/Athens" />
            <option value="Europe/Belgrade" label="Europe/Belgrade" />
            <option value="Europe/Berlin" label="Europe/Berlin" />
            <option value="Europe/Brussels" label="Europe/Brussels" />
            <option value="Europe/Bucharest" label="Europe/Bucharest" />
            <option value="Europe/Budapest" label="Europe/Budapest" />
            <option value="Europe/Chisinau" label="Europe/Chisinau" />
            <option value="Europe/Copenhagen" label="Europe/Copenhagen" />
            <option value="Europe/Dublin" label="Europe/Dublin" />
            <option value="Europe/Gibraltar" label="Europe/Gibraltar" />
            <option value="Europe/Helsinki" label="Europe/Helsinki" />
            <option value="Europe/Istanbul" label="Europe/Istanbul" />
            <option value="Europe/Kaliningrad" label="Europe/Kaliningrad" />
            <option value="Europe/Kiev" label="Europe/Kiev" />
            <option value="Europe/Lisbon" label="Europe/Lisbon" />
            <option value="Europe/London" label="Europe/London" />
            <option value="Europe/Luxembourg" label="Europe/Luxembourg" />
            <option value="Europe/Madrid" label="Europe/Madrid" />
            <option value="Europe/Malta" label="Europe/Malta" />
            <option value="Europe/Minsk" label="Europe/Minsk" />
            <option value="Europe/Monaco" label="Europe/Monaco" />
            <option value="Europe/Moscow" label="Europe/Moscow" />
            <option value="Europe/Oslo" label="Europe/Oslo" />
            <option value="Europe/Paris" label="Europe/Paris" />
            <option value="Europe/Prague" label="Europe/Prague" />
            <option value="Europe/Riga" label="Europe/Riga" />
            <option value="Europe/Rome" label="Europe/Rome" />
            <option value="Europe/Samara" label="Europe/Samara" />
            <option value="Europe/Sofia" label="Europe/Sofia" />
            <option value="Europe/Stockholm" label="Europe/Stockholm" />
            <option value="Europe/Tallinn" label="Europe/Tallinn" />
            <option value="Europe/Tirane" label="Europe/Tirane" />
            <option value="Europe/Vaduz" label="Europe/Vaduz" />
            <option value="Europe/Vienna" label="Europe/Vienna" />
            <option value="Europe/Vilnius" label="Europe/Vilnius" />
            <option value="Europe/Warsaw" label="Europe/Warsaw" />
            <option value="Europe/Zurich" label="Europe/Zurich" />
            <option value="Indian/Mahe" label="Indian/Mahe" />
            <option value="Indian/Mauritius" label="Indian/Mauritius" />
            <option value="Pacific/Gambier" label="Pacific/Gambier" />
            <option value="Pacific/Honolulu" label="Pacific/Honolulu" />
            <option value="Pacific/Marquesas" label="Pacific/Marquesas" />
            <option value="Pacific/Tahiti" label="Pacific/Tahiti" />
         </preference>
         <preference name="viewmode" label="View Mode" type="list" defaultValue="AGENDA">
            <option value="WEEK" label="Week" />
            <option value="MONTH" label="Month" />
            <option value="AGENDA" label="Agenda" />
         </preference>
         <preference name="height" label="Height (px)" type="range" min="10" max="1000" step="10" defaultValue="300" />
         <preference name="calendars" defaultValue="9" type="hidden"/>
	 <preference name="cal1" label="Calendar 1 ID" type="text" defaultValue="usa@holiday.calendar.google.com" />
	 <preference name="color1" label="Calendar 1 Color" type="text" defaultValue="#3366cc" />
	 <preference name="cal2" label="Calendar 2 ID" type="text" />
	 <preference name="color2" label="Calendar 2 Color" type="text" />
	 <preference name="cal3" label="Calendar 3 ID" type="text" />
	 <preference name="color3" label="Calendar 3 Color" type="text" />
	 <preference name="cal4" label="Calendar 4 ID" type="text" />
	 <preference name="color4" label="Calendar 4 Color" type="text" />
	 <preference name="cal5" label="Calendar 5 ID" type="text" />
	 <preference name="color5" label="Calendar 5 Color" type="text" />
	 <preference name="cal6" label="Calendar 6 ID" type="text" />
	 <preference name="color6" label="Calendar 6 Color" type="text" />
	 <preference name="cal7" label="Calendar 7 ID" type="text" />
	 <preference name="color7" label="Calendar 7 Color" type="text" />
	 <preference name="cal8" label="Calendar 8 ID" type="text" />
	 <preference name="color8" label="Calendar 8 Color" type="text" />
	 <preference name="cal9" label="Calendar 9 ID" type="text" />
         <preference name="color9" label="Calendar 9 Color" type="text" />
      </widget:preferences>
 
      <style type="text/css">
      </style>
 
      <script type="text/javascript">
         var GoogleCalendar = {}     

	 GoogleCalendar.load = function()
         {
            var URL = GoogleCalendar.genURL();
	    
	    var contentHTML = "";	
	    if (URL == null)
	    {
               contentHTML = "<p>You do not currently have any calendars specified.</p>";
	    }
	    else
	    {
               contentHTML = "<iframe src=\""+URL+"\" style=\"width:100%;border-width:0;\" frameborder=\"0\" height=\""+widget.getValue("height")+"px\"></iframe>";
            }

            widget.setBody(contentHTML); 
	 }

	 GoogleCalendar.genURL = function()
	 {
            var URL = "http://www.google.com/calendar/embed?";

            URL = URL + "showTitle=0";
            URL = (widget.getValue("nav") == "true") ? URL + "&showNav=1" : URL + "&showNav=0";
            URL = (widget.getValue("dates") == "true") ? URL + "&showDate=1" : URL + "&showDate=0";
            URL = (widget.getValue("tabs") == "true") ? URL + "&showTabs=1" : URL + "&showTabs=0";
	    URL = (widget.getValue("cals") == "true") ? URL + "&showCalendars=1" : URL + "&showCalendars=0";
            URL = (widget.getValue("print") == "true") ? URL + "&showPrint=1" : URL + "&showPrint=0";
            URL = URL + "&mode=" + widget.getValue("viewmode");
            URL = URL + "&height=" + widget.getValue("height");
            URL = URL + "&wkst=1";
            URL = URL + "&bgcolor=%23FFFFFF";
            URL = URL + "&ctz=" + widget.getValue("timezone");

	    var isValid = 0;
            for (var i = 1; i < (parseInt(widget.getValue("calendars")) + 1) ; i++)
            {
               var calendar = widget.getValue("cal" + i.toString());
               var color = widget.getValue("color" + i.toString());

               if ((calendar == null) || (calendar == "") || (color == null) || (color == ""))
               {
                  continue;
               }

               if (calendar.indexOf("@") < 0)
               {
                  alert("Invalid Calendar ID: Calendar " + i.toString());
                  continue;
               }

               if ((color.indexOf("#") < 0) || (color.length < 7))
               {
                  alert("Invalid Color: Color " + i.toString());
                  continue;
               }

	       isValid = 1;
	       URL = URL + "&src=" + escape(calendar) + "&color=" + escape(color);
            }

	    if (isValid == 0) return null;
            return URL;
         }         

         widget.onLoad = function()
         {
            GoogleCalendar.load();
         }

         widget.onRefresh = function() 
         {
            GoogleCalendar.load();
         }
      </script>
   </head>

   <body>
      <p>Loading...</p>
   </body>

</html>
